package homework;

public class p1652 {
    private static int count=1;
    public static void main(String[] args) {
       Add add1=new Add(count);
       Add add2=new Add(count);
       Sub sub1=new Sub(count);
       Sub sub2=new Sub(count);

       Thread thread1=new Thread(add1);
       Thread thread2=new Thread(add2);
       Thread thread3=new Thread(sub1);
       Thread thread4=new Thread(sub2);

       thread1.start();
       thread2.start();
       thread3.start();
       thread4.start();

    }


}

class Add implements Runnable{
    private  int count;

    public Add(int count){
        this.count=count;
    }

    @Override
    public void run() {
        System.out.println("循环加线程已启动");
        for(int i=0;i<10;i++){
            count++;
            System.out.print(count+" ");
        }
    }

}

class Sub implements Runnable{
    private int count;

    public Sub(int count){
        this.count=count;
    }

    @Override
    public void run() {
        System.out.println("循环减线程已启动");
    for (int i=0;i<10;i++){
        count--;
        System.out.print(count+" ");
    }
    }
}

